package com.fuershiye.woman.monitor.beans;

import com.fuershiye.woman.monitor.constants.Massage;

/**
 * 
 * @author yongyongdong
 *
 */
public class Result<T> extends BaseObject {

	private static final long serialVersionUID = 8104857028177163933L;

	//200,表示成功
	private Integer code;
	
	//提示信息
	private String massage;
	
	//返回数据的封装
	private T data;

	public Result () {
    	this.code = 000;
    	this.massage = "";
    	this.data = null;
    }
    
    public Result (Integer code, String massage, T data) {
    	this.code = code;
    	this.massage = massage;
    	this.data = data;
    }
    
    public Result (Integer code, String massage) {
    	this.code = code;
    	this.massage = massage;
    }
    
    public Result (Massage massage) {
    	this.code  = massage.getStatus();
    	this.massage = massage.getMsg();
    }
    
    public Result (Massage massage, T data) {
    	this.code  = massage.getStatus();
    	this.massage = massage.getMsg();
		this.data = data;
    }
    
    public boolean isSuccess() {
        return this.code == 200;
    }

	public Integer getCode() {
		return code;
	}

	public void setCode(Integer code) {
		this.code = code;
	}

	public String getMassage() {
		return massage;
	}

	public void setMassage(String massage) {
		this.massage = massage;
	}

	public T getData() {
		return data;
	}

	public void setData(T data) {
		this.data = data;
	}
    
}
